
import { request } from "@/http/axios"
import * as BS from "./types/index"

// 根据id查询基础数据参数
export function searchStructDataApi(params: BS.PageTableRequestData) {
  return request<BS.BSTableResData>({
    url: `/toksim/model/basicData/search`,
    method: 'post',
    params: {
      pageSize: params.size,
      pageNum: params.current_page
    },
    data: params
  })
}

// 根据id查询基础数据参数
export function listStructField(data: any) {
  return request<BS.BSFieldResData>({
    url: `/toksim/model/basicData/field/list`,
    method: 'post',
    data
  })
}

// 基础数据详情
export function detailStructField(id: number | string) {
  return request<BS.BSViewResData>({
    url: `/toksim/model/basicData/getBasicDataInfo/${id}`,
    method: 'get'
  })
}

// 选取数据结构
export function selectDataStruct() {
  return request<BS.BSFieldResData>({
    url: `/toksim/model/basicData/selectDataStruct`,
    method: 'post',
  })
}
// 保存基础数据参数
export function saveStructField(data: BS.SaveRequestData) {
  return request<BS.BSFieldResData>({
    url: `/toksim/model/basicData/save`,
    method: 'post',
    data
  })
}

// 根据id查询基础数据参数
export function listStructEnum(data: any) {
  return request<BS.BSEnumResData>({
    url: `/toksim/model/basicData/enum/list`,
    method: 'post',
    data
  })
}

// 根据id删除基础数据参数
export function deleteStructField(id: number | string) {
  return request<BS.BSEnumResData>({
    url: `/toksim/model/basicData/delete/${id}`,
    method: 'delete',
  })
}

// 批量删除基础数据参数
export function deleteStructFieldBatch(ids: number | string[]) {
  return request<BS.BSEnumResData>({
    url: `/toksim/model/basicData/batchDelete`,
    method: 'delete',
    data: { ids }
  })
}
